<?php


namespace app\validate;

use app\model\AdminUsers;
use think\Validate;
use app\model\AdminUser;


class AdminUserAddValidate extends Validate
{
    protected $rule = [
        'username'  => 'require|max:25|unique:admin_users',
        'name'      => 'require|max:25',
        'password'  => 'require|min:6',
        'phone' => 'regex:/^1[3-9]\d{9}$/',
        'email' => 'email',
        'role_id'   => 'require|in:1,2,3'
    ];

    protected $message = [
        'username.require' => '用户名必须',
        'username.unique'  => '用户名已存在',
        'password.require' => '密码必须',
        'password.min'     => '密码至少6位',
        'phone.mobile'     => '手机号格式错误',
        'role_id.in'       => '角色参数错误'
    ];
}